﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace PMS.Controllers.BD
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/
        public ActionResult Index()
        {
            @ViewData.Model = OperateContext.sessUserInfo;
            return View();
        }
        public ActionResult Login()
        {
            //string usercode = Request.Cookies["usercode"] == null ? null : Request.Cookies["usercode"].Value;
            //string password = Request.Cookies["password"] == null ? null : Request.Cookies["password"].Value;
            //ViewData["IsCookie"] = !string.IsNullOrEmpty(usercode);
            //ViewData["usercode"] = HttpUtility.UrlDecode(usercode, Encoding.GetEncoding("UTF-8"));
            //ViewData["password"] = password;
            return View();
        }
        public ActionResult LoginMethod(string usercode, string password)
        {
            return Json(BLLSession.Current.BD_UserInfoBLL.LoginMethod(usercode, password), JsonRequestBehavior.AllowGet);
        }
        public ActionResult GetPerTree()
        {
            List<TreeNode> node = Permission.GetPerTree(OperateContext.SessPermission);
            //System.Runtime.Serialization.Json(node);
            return Json(node);
        }
        public ActionResult Mydesk()
        {
            return View();
        }
    }
}
